<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
  </head>

  <body>
    <script>
      const arr = [1, 1, 1, 1, 2, 2, 2, 3, 33, 44, 44, 44, 55, 55, 6, 7, 7, 7, 7]
      // 利用对象特性 给数组去重
      // key值唯一性

      const noRepeat = (arr) => {
        const obj = {} // key
        for (let i = 0; i < arr.length; i++) {
          if (obj[arr[i]]) {
            obj[arr[i]]++
          } else {
            obj[arr[i]] = 1
          }
        }
        return obj
      }
      const obj = noRepeat(arr)
      console.log('obj', obj, Object.keys(obj), Object.values(obj))

      // [{}, {}, {}, {}]

    </script>
  </body>

</html>